SYS.MEM.ALLOC
0x0000
NET.UPLINK
ESTABLISHING
SEC.PROTOCOL
AWAITING
DATA.STREAM
0.0.0.0
0%
INITIALIZING SYSTEM
[
]
Portfolio Learn Month 02 Networking Basics

🌐 Day 9: Domain Name System (DNS)

Networking DNS

The Domain Name System (DNS) is a distributed hierarchical system that resolves domain names into IP addresses. 🌐


Humans remember:
google.com

Machines understand:
142.250.190.14

DNS translates names into numeric IP addresses so computers can communicate.


🔎 How DNS Resolution Works

Suppose you search for:
google.com

Here’s what happens step by step:

1️⃣ Client Request

Flow:
BrowserOS Stub Resolver

The stub resolver is part of the operating system, not the browser.


2️⃣ Local Lookup (Before Internet Query)

The stub resolver checks locally in this order:

  1. Browser DNS Cache
  2. OS DNS Cache
  3. Hosts File
    • Windows: C:\Windows\System32\drivers\etc\hosts
    • Linux: /etc/hosts

If the IP is found → resolution stops.
If not found → query is forwarded to a Recursive DNS Server, such as:


3️⃣ Recursive DNS Server

The first external DNS server contacted is called the:

Recursive Resolver
Its job is to fully resolve the domain.

It first checks:

If found → returns IP.
If not → it begins querying the DNS hierarchy.


4️⃣ Root DNS Servers

There are 13 named root server systems (A–M).
They are globally distributed using Anycast and coordinated by:

When asked:

“Where is google.com?”

The root server replies:

“I don’t know google.com, but here are the name servers for .com.”

It returns NS (Name Server) records for the .com TLD.


🔹 What is a TLD?

TLD = Top Level Domain

Examples:

It is the last portion of a domain name.


🔹 Manual Root Query Example

You can manually query a root server:

nslookup -type=NS com. m.root-servers.net

This asks:

“Who manages the .com TLD?”

The root server returns TLD name servers like:

a.gtld-servers.net
b.gtld-servers.net
...


5️⃣ TLD Name Servers (.com Servers)

The recursive resolver contacts one of the .com TLD servers and asks:

“Who is authoritative for google.com?”

The TLD server returns the Authoritative Name Servers for that domain.

Example:

nslookup -type=NS chatgpt.com d.gtld-servers.net

This shows which servers manage chatgpt.com.


6️⃣ Authoritative Name Servers (Final Step)

Now the recursive resolver asks one of the authoritative servers:

“What is the A record (IP address) for google.com?”

The authoritative server replies with the final IP address.


7️⃣ Caching and TTL

When the recursive resolver receives the IP:

Note: DNS TTL is different from packet TTL.

Then:

Future lookups are faster until TTL expires.


🧠 Final DNS Flow Summary

  1. Browser requests google.com
  2. Stub Resolver checks:
    • Browser cache
    • OS cache
    • Hosts file
  3. Stub Resolver queries Recursive DNS Server
  4. Recursive Server checks its cache
  5. If not found:
    • Queries Root Server
    • Gets TLD (.com) servers
  6. Queries TLD Server
    • Gets Authoritative Name Servers
  7. Queries Authoritative Server
    • Gets IP address
  8. IP returned to Browser
  9. All layers cache the result using TTL

🎥 Reference Video: